package com.mmall.dto;

import com.mmall.model.SysDept;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 适配器,用于后续生成树形结构
 */
@Setter
@Getter
@ToString
public class DeptLevelDto extends SysDept {
    private List<DeptLevelDto> deptList = new ArrayList<>();

    public static  DeptLevelDto adapt(SysDept dept){
        DeptLevelDto dto = new DeptLevelDto();
        //将dept中相同的bean拷贝到dto中
        BeanUtils.copyProperties(dept,dto);
        return dto;
    }
}
